<?php
include_once 'admin_global.php';            //加载后台统一调用类文件
$db->Get_user_shell_check($uid, $shell);    //检测用户是否登录

//从数据库里查询管理员的信息
$userType=$_SESSION['userType'];
if($userType=='普通管理员'){
    $userID=$_SESSION['uid'];
    $query=$db->select("admin","*","userID=$userID");
}else{
    $query=$db->findall("admin");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>管理员列表</title>
        <link rel="stylesheet" href="css/right.css" type="text/css" /> 
        <script src="js/jquery-1.12.4.min.js" type="text/javascript"></script>
        <script src="js/bggl.js" type="text/javascript"></script>
    </head>
    <script>
        function delAdmin(){
            if(window.confirm('你确定要删除这个用户吗？')){
                return true;
            }else{
                return false;
            }
        }
    </script>
    <body>
        <div id="right_main">
            <div class="right_content">
                <div class="right_top_menu">
                    <h3>
                        您当前的位置：后台 > 管理员设置 > 管理员列表
                    </h3>
                </div>
                <div class="right_center_content">
                    <form id="form1" method="post" action="">
                        <table cellpadding="0" cellspacing="0" border="0" width="100%">
                            <tr>
                                <td valign="top" >
                                    <div class="txl_search"></div>
                                    <table cellpadding="0" cellspacing="0" border="0" width="100%" class="fg_table txl_table" id="table1">
                                        <tr>
                                            <th width="4%">ID</th>
                                            <th width="10%">用户名称</th>
                                            <th width="5%">性别</th>
                                            <th width="10%">用户类型</th>
                                            <th width="15%">用户邮箱</th>
                                            <th width="15%">创建时间</th>
                                            <th width="15%">最近登录时间</th>
                                            <th width="13%">最近登录IP</th>
                                            <th width="5%">是否激活</th>
                                            <th width="4%">修改</th>
                                            <th width="4%">删除</th>
                                        </tr>
                                        <?php while($row=$db->fetch_array($query)){; ?>
                                        <tr>
                                            <td><?php echo $row['userID']; ?></td>
                                            <td><?php echo $row['userName']; ?></td>
                                            <td><?php echo $row['userSex']; ?></td>
                                            <td><?php echo $row['userType']; ?></td>
                                            <td><?php echo $row['userEmail']; ?></td>
                                            <td><?php echo date("Y-m-d H:m:s",$row['userCreateTime']); ?></td>
                                            <td><?php echo date("Y-m-d H:m:s",$row['recentLoginTime']); ?></td>
                                            <td><?php echo $row['recentLoginIP']; ?></td>
                                            <td><?php echo $row['userEnabled']?"是":"否"; ?></td>
                                            <td><a href="editAdmin.php?userID=<?php echo $row['userID']; ?>"><img src="images/adj_bg.gif" width="15" height="15" border="0" /></a></td>
                                            <td><a href="delAdmin.php?userID=<?php echo $row['userID']; ?>" onclick="javascript:return delAdmin();"><img src="images/del2.gif" width="16" height="16" border="0" /></a></td>
                                        </tr> 
                                        <?php }; ?>    
                                    </table>
                                </td>
                            </tr>   
                        </table>
                    </form>
                </div>
            </div>
        </div>
    </body>
</html>
